<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>压盖顺序_z-index属性</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        /* 兄弟级别
        div.box1{
            width: 400px;
            height: 400px;
            background: pink;
            float: left;
        }
        div.box2{
            width: 300px;
            height: 300px;
            background: skyblue;
            position: relative;
            left: 0;
            top: 0;
            z-index: 1;
        }
        div.box3{
            width: 200px;
            height: 200px;
            background: orange;
            position: absolute;
            left: 0;
            top: 0;
            z-index: 2;
        }
        div.box4{
            width: 100px;
            height: 100px;
            background: yellowgreen;
            position: fixed;
            left: 0;
            top: 0;
            z-index: 3;
        } */
        /* 父子级别 */
        div{
            width: 200px;
            height: 200px;
            background: green;
            position: absolute;
            left: 100px;
            top: 100px;
            z-index: 10;
        }
        div p{
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
            left: 0;
            top: 0;
            z-index: 9;
        }
    </style>
</head>
<body>
    <!-- 兄弟级别
    <div class="box1">浮动，或者标准流</div>  
    <div class="box2">相对定位</div>   
    <div class="box3">绝对定位</div>
    <div class="box4">固定定位</div>
    -->
    <!-- 父子级别 -->
    <div>
        <p></p>
    </div>
</body>
</html>